#include <stdio.h>

int main(){
    int n = 0,a = 0;
    int x = 0;
    scanf("%d", &n);
    for(a = 2; a <= n;a++)
    {
        int sum = 0;
        for(int j = 1;j < a ; j++){
            if(a % j == 0)
                sum += j;
        }
        if(a == sum)
            x++;
    }
    printf("%d\n", x);
    return 0;
}
